package feign.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import feign.client.SampleFeignClient;
import feign.serive.SampleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2016/11/1.
 */
@RestController
public class FeignClientController implements SampleService {
    @Autowired
    private SampleFeignClient sampleFeignClient;

    @Override
    @HystrixCommand(fallbackMethod = "fallBack")
    public String getUserById(@PathVariable("id") String id) {
        return sampleFeignClient.getUserById(id);
    }

    public String fallBack(String args){

        return "this is fall back HYSTRIX" +args;
    }
}
